// Include Files
#include "Game.h"

#include "Managers\MeshManager.h"
#include "Managers\ShaderManager.h"
#include "Managers\TextureManager.h"

/////////////////////////////////////////////////////////////////////////////////////
// CGame Implementation

IE::CGame::CGame() { }

IE::CGame::~CGame() { }

void IE::CGame::Initialize()
{
	// start up managers
	m_pMeshManager->Initialize();
	m_pShaderManager->Initialize();
	m_pTextureManager->Initialize();

	//// start up the game
	//string_t strTitle;
	//string_t strSceneFile;

	//// read the game file
	//file_t GameFile;
	//if( GameFile.Open(L"..\\Galleons\\Galleons.game", L"r") )
	//{
	//	char_t szLine[32];

	//	// read the title
	//	GameFile.ReadLine(szLine, 32);
	//	strTitle = string_t(szLine);

	//	// read the scene file name
	//	GameFile.ReadLine(szLine, 32);
	//	strSceneFile = L"..\\Galleons\\Scenes\\" + string_t(szLine);

	//	// close the game file
	//	GameFile.Close();
	//}
	//else
	//{
	//	assert(false);
	//}

	//// read the scene file
	//file_t SceneFile;
	//if( SceneFile.Open(strSceneFile, L"r") )
	//{
	//	char_t szLine[32];
	//	int iCount;

	//	// load meshes
	//	SceneFile.ReadLine(szLine, 32);
	//	iCount = _wtoi(szLine);
	//	for( int i = 0; i < iCount; ++i )
	//	{
	//		SceneFile.ReadLine(szLine, 32);
	//		m_pMeshManager->LoadMeshFile(szLine);
	//	}

	//	// load shaders
	//	SceneFile.ReadLine(szLine, 32);
	//	iCount = _wtoi(szLine);
	//	for( int i = 0; i < iCount; ++i )
	//	{
	//		SceneFile.ReadLine(szLine, 32);
	//		m_pShaderManager->LoadShaderFile(szLine);
	//	}

	//	// load textures
	//	SceneFile.ReadLine(szLine, 32);
	//	iCount = _wtoi(szLine);
	//	for( int i = 0; i < iCount; ++i )
	//	{
	//		SceneFile.ReadLine(szLine, 32);
	//		m_pTextureManager->LoadTextureFile(szLine);
	//	}

	//	// close the scene file
	//	SceneFile.Close();
	//}
	//else
	//{
	//	assert(false);
	//}
}

void IE::CGame::Shutdown()
{
	// shut down managers
	m_pTextureManager->Shutdown();
	m_pShaderManager->Shutdown();
	m_pMeshManager->Shutdown();
}

//void CGame::AddRenderState( CRenderState *_pRenderState )
//{
//	RenderStateAdd.Raise(new CRenderStateEventArg(_pRenderState));
//}
//
//void CGame::RemoveRenderState( CRenderState *_pRenderState )
//{
//	RenderStateRemove.Raise(new CRenderStateEventArg(_pRenderState));
//}
//
//void CGame::AddScriptState( CScriptState *_pScriptState )
//{
//	ScriptStateAdd.Raise( new CScriptStateEventArg(_pScriptState));
//}
//
//void CGame::RemoveScriptState( CScriptState *_pScriptState )
//{
//	ScriptStateRemove.Raise( new CScriptStateEventArg(_pScriptState));
//}
